#include <iostream>
#include <string>
#include <regex>

using namespace std;

void show_ip (const string& ip)
{
	const regex pattern ("(\\d{1,3}):(\\d{1,3}):(\\d{1,3}):(\\d{1,3})");
	std::match_results<string::const_iterator> result;
	bool valid = regex_match(ip, result, pattern);
	cout << ip << (valid ? "\tvalid" : "\tinvalid") << endl;
	if (valid)
	{
		for (auto &i : result)
			cout << i << "\t";
		cout << endl;
	}
}

int main (void)
{
	show_ip ("10:31:17:253");
	return 0;
}


